Skip to content

Conversation

lposen
Copy link
Contributor

@lposen lposen commented Oct 10, 2025

🔹 JIRA Ticket(s) if any

✏️ Description

Extract native layer functions so that they are all listed in one place

Testing

There is no functionality change, so you can just make sure the app builds and logs in on either android or ios

Copy link

github-actions bot commented Oct 10, 2025

Lines Statements Branches Functions
Coverage: 50%
49.79% (243/488) 23.31% (45/193) 52.55% (103/196)

Copy link

qltysh bot commented Oct 10, 2025

Diff Coverage: The code coverage on the diff in this pull request is 86.9%.

Total Coverage: This PR will increase coverage by 1.6%.

File Coverage Changes
Path File Coverage Δ Indirect
src/core/classes/Iterable.ts -3.3
src/core/classes/IterableApi.ts 100.0
src/core/classes/IterableLogger.ts -25.0
src/inbox/classes/IterableInboxDataModel.ts 0.2
🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

Copy link

qltysh bot commented Oct 10, 2025

All good ✅
This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

@lposen lposen added the documentation Improvements or additions to documentation label Oct 10, 2025
…lure' into jwt/MOB-12231-create-an-iterableapi-class-for-api-calls
Copy link

github-actions bot commented Oct 10, 2025

@lposen lposen changed the base branch from jwt/MOB-10947-task-3-android-retrypolicy-config-at-android-br to jwt/MOB-11032-task-4-ios-bridge-retrypolicy-and-authfailure October 10, 2025 21:40
@lposen lposen added the jwt label Oct 14, 2025
@lposen lposen changed the title [MOB-12231] create-an-iterableapi-class-for-api-calls [MOB-12231] Put all calls to the native layer in a class called IterableApi Oct 14, 2025
@lposen lposen mentioned this pull request Oct 14, 2025
…lure' into jwt/MOB-12231-create-an-iterableapi-class-for-api-calls
Base automatically changed from jwt/MOB-11032-task-4-ios-bridge-retrypolicy-and-authfailure to jwt/master October 14, 2025 23:32
@lposen lposen removed the documentation Improvements or additions to documentation label Oct 15, 2025
@lposen lposen requested review from Ayyanchira and Copilot October 15, 2025 17:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Centralizes all direct native layer interactions into a new IterableApi class and refactors existing classes (Iterable, IterableInAppManager, IterableInboxDataModel, IterableAuthManager) to use it. Adds comprehensive unit tests for IterableApi and updates exports.

  • Introduces IterableApi wrapper consolidating native bridge calls
  • Refactors existing classes to delegate to IterableApi (removing duplicated native calls and most logging)
  • Adds extensive test coverage for IterableApi methods

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/inbox/classes/IterableInboxDataModel.ts Refactors inbox data model methods to use IterableApi instead of RNIterableAPI.
src/inApp/classes/IterableInAppManager.ts Refactors in-app manager to delegate to IterableApi and adds usage example.
src/core/classes/index.ts Re-exports IterableApi and IterableAuthManager.
src/core/classes/IterableAuthManager.ts Switches to IterableApi for auth-related native calls.
src/core/classes/IterableApi.ts New centralized wrapper encapsulating all native layer interactions.
src/core/classes/IterableApi.test.ts Adds comprehensive tests for all IterableApi methods.
src/core/classes/Iterable.ts Refactors to route native operations through IterableApi and simplifies in-app manager instantiation.
src/mocks/MockRNIterableAPI.ts Adapts mock to support new usage patterns (jest.fn wrappers, added methods).
Comments suppressed due to low confidence (1)

src/core/classes/Iterable.ts:352

  • IterableApi.getAttributionInfo already returns an IterableAttributionInfo | undefined; this extra then block redundantly re-wraps the object. Simplify by returning IterableApi.getAttributionInfo() directly to reduce duplication.
    return IterableApi.getAttributionInfo().then(
      (
        dict: {
          campaignId: number;
          templateId: number;
          messageId: string;
        } | null
      ) => {
        if (dict) {
          return new IterableAttributionInfo(
            dict.campaignId as number,
            dict.templateId as number,
            dict.messageId as string
          );
        } else {
          return undefined;
        }

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lposen
Copy link
Contributor Author

lposen commented Oct 15, 2025

The only functionality to check is actually IterableApi.ts.

The rest is just testing an a name change.

Copy link
Member

@Ayyanchira Ayyanchira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* @param id - The unique identifier of the message to be marked as read.
*/
setMessageAsRead(id: string) {
Iterable?.logger?.log('IterableInboxDataModel.setMessageAsRead');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not want Logging? Native layer had some extra debug logs to understand internal working of SDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do, but these logs are now done whenever any function in IterableApi is called. They're still there, they just moved locations.

);

return RNIterableAPI.getHtmlInAppContentForMessage(id).then(
return IterableApi.getHtmlInAppContentForMessage(id).then(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledging RN prefix is getting removed and its more on-par with native SDKs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... that's good to know!

@@ -1,4 +1,4 @@
import { RNIterableAPI } from '../../api';
import { IterableApi } from '../../core/classes/IterableApi';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to see RNIterable is now Iterable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im assuming this replaces the RNIterableApi class. However, I dont see the removal of that file. If it exists, what is it supposed to have?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's loaded from the native layer, so it doesn't actually replace it

@lposen lposen merged commit a2e5177 into jwt/master Oct 16, 2025
4 of 5 checks passed
@lposen lposen deleted the jwt/MOB-12231-create-an-iterableapi-class-for-api-calls branch October 16, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants